package com.service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.mapper.OrdersMapper;
import com.model.Orders;
@Service
public class OrdersServiceImpl implements OrdersService
{
        
        @Autowired
	private OrdersMapper ordersMapper;


	public List<Orders> queryOrdersList(Orders orders) throws Exception {
		Map<String, Object> map = new HashMap<String, Object>();
		if(orders!=null){
			 map.put("gid", orders.getGid());
			 map.put("uid", orders.getUid());
		}
		
		List<Orders> getOrders = ordersMapper.query(map);
		return getOrders;
	}

	public int insertOrders(Orders orders) throws Exception {
		
		return ordersMapper.insertOrders(orders);
	}

	public int deleteOrders(int id) throws Exception {
		return ordersMapper.deleteOrders(id);
	}

	public int updateOrders(Orders orders) throws Exception {
		return ordersMapper.updateOrders(orders);
	}
	
	public Orders queryOrdersById(int id) throws Exception {
		return ordersMapper.queryOrdersById(id);
	}
 
}
